﻿
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>存货库存选择</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/framework/commonjs.js"></script>
    <script src="~/js/layui/layui.js"></script>
    <script src="~/js/sysweb/inventoryjs.js"></script>
</head>
<body>
    <div class="layui-fluid" style="margin:5px">
        <ul lay-bar="disabled" class="mWebBanner">
            <li class="layui-nav-item" style="float:left;">
                <button type="button" onclick="Confirm()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#x1005;</i>确定选择
                    </button>
            </li>
            <li class="layui-nav-item" style="float:left;margin-left:3%">
                <button type="button" onclick="loadData()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#xe615;</i>检索查询
                </button>
            </li>
            <li class="layui-nav-item" style="float:left;margin-left:3%">
                <button type="button" onclick="closeWin()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#x1007;</i>关闭页面
                </button>
            </li>
        
        </ul>

        <div style="float:left;width:100%;">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                        <div class="layui-inline layui-show-xs-block">

                            <input type="text" name="cInvCode" placeholder="存货编码" autocomplete="off" class="layui-input" id="cInvCode">
                        </div>
                        <div class="layui-inline layui-show-xs-block">

                            <input type="text" name="cInvName" placeholder="存货名称" autocomplete="off" class="layui-input" id="cInvName">
                        </div>
                        <div class="layui-inline layui-show-xs-block">

                            <input type="text" name="cInvStd" placeholder="规格型号" autocomplete="off" class="layui-input" id="cInvStd">
                        </div>

                    </form>
                </div>
          
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-hide" id="list" lay-filter="list"></table>
                </div>
            </div>


        </div>
    </div>
</body>

</html>

<script>
    var cData = new Array();
    function loadData() {
        layui.use('table', function () {
            var conditon = JSON.stringify(FormToJson("qForm"));
            var table = layui.table;
            table.render({
                elem: '#list'
                , cols: [[ //标题栏
                    { type: 'checkbox' }
                    , { field: 'proCode', title: '存货编码', width: 180 }
                    , { field: 'proName', title: '存货名称', width: 180 }
                    , { field: 'spec', title: '规格', width: 130 }
                    , { field: 'cBatch', title: '批次', width: 130 }
                    , { field: 'cjStock', title: '车间库存', width: 130 }
                    , { field: 'number', title: '总库存', width: 130 }
                    
                ]], done: function (res, curr, count) {
                    $("[data-field='mUnit']").css('display', 'none');//隐藏列
                }
                , url: "../Basic/getDataList?condition=" + conditon + "&dataType=venStock&conditon=" + conditon
                , skin: 'row' //表格风格
                , even: true
                , page: true //是否显示分页
                , limits: [20, 35, 50]
                , limit: 20 //每页默认显示的数量
            });

            //监听工具条
            table.on('checkbox(list)', function (obj) {
                var checkStatus = table.checkStatus('list');
                var select = new Array();
                for (var i = 0; i < checkStatus.data.length; i++) {
                    select.push(checkStatus.data[i]);
                }
                cData = select;
            });
        });
    }
    var single = "1";

    $(function () {
        single = getUrlVariable("isSingle");
        loadData();
    })
 
    /**
    确认选择
    **/
    function Confirm() {

        if (cData.length < 1) {
            layer.msg("您没有选择任何数据"); return;
        } else {
            if (single == "1" && cData.length > 1) {
                layer.msg("请选择一条数据"); return;
            } else {
            
                parent.getChildPar(cData); //这是父页面函数
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        }
    }
</script>

